<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>取两个数之间的随机数</title>
    <script>
        var startNum = 10;
        var endNum = 20;
        for (var i = 0; i < 100; i++) {
            console.log(setRandomNum(startNum,endNum));
            //console.log(random(Math.random()));
        }
        function setRandomNum(startNum,endNum) {
            var total = endNum - startNum + 1;
            return Math.floor(Math.random() * total + startNum);
        }
    </script>
</head>
<body>

</body>
</html>